import Vue from 'Vue'
import nprogress from 'nprogress'
import 'nprogress/nprogress.css'
import router from './router'

const app = function () {
  //在任何导航被触发前执行
  router.beforeEach((to, from, next) => {
    nprogress.start()
    next()
  })
  //导航中的最后一个钩子
  router.afterEach((to, from) => {
    nprogress.done()
  })

  new Vue({
    router,
    el: '#app'
  })
}

export { app }